package com.xnxy.design.service;

import com.xnxy.design.mapper.CoreMapper;
import com.xnxy.design.mapper.UserMapper;
import com.xnxy.design.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService extends CoreService<User, Integer> {

    @Autowired
    UserMapper userMapper;

    @Override
    public CoreMapper<User, Integer> getMapper() {
        return userMapper;
    }


    public boolean isLogin(String username, String pswd) {
        User user=userMapper.isLogin(username);
        if (user!=null&&user.getPassword().equals(pswd)){
            return true;
        }else {
            return false;
        }
    }

    public User getByusername(String username) {
        User user=userMapper.isLogin(username);
        return user;
    }
}
